<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>#{msg.page_reg}</title>
    <h:outputStylesheet library="css" name="style.css"/>
    <h:outputScript library="js" name="login.js"/>

</h:head>
<h:body>


    <div class="center">
        <div style="text-align:right;">
        </div>
        <div class="text">#{msg.page_reg} :</div>


        <h:form>
            <!--<h:message for="RegisterGroupPanel" style="color:red;" />-->

            <h:panelGrid  id="RegisterGroupPanel" rendered="#{!registration.codeSent}">
                <p:growl id="growl" showDetail="true" sticky="true" />

                <h:outputLabel for="login" value="#{msg.text_login} : " />
                <h:inputText id="login" value="#{registration.login}" required="true"
                             requiredMessage="#{msg.text_enterLogin}"
                             validator="#{registration.checkLogin}">
                    <f:ajax event="blur" render="loginError"/>
                </h:inputText>

                <p:message  id="loginError" for="login" style="color: red;" />

                <h:outputLabel for="pass" value="#{msg.text_pass} : " />
                <h:inputSecret id="pass" value="#{registration.pass}" required="true"
                               requiredMessage="#{msg.text_enterPass}">
                    <f:validator validatorId="regValidator" />
                    <f:attribute name="confirmPassword" value="#{confirmPassword}" />
                </h:inputSecret>
                <p:message for="pass" style="color: red;" />

                <h:outputLabel for="checkPass" value="#{msg.text_confirmPass} : " />
                <h:inputSecret id="checkPass" required="true"
                               binding="#{confirmPassword}"
                               requiredMessage="#{msg.text_confirmPass}" >
                </h:inputSecret>
                <p:message  for="checkPass" style="color: red;" />

                <h:outputLabel for="email" value="#{msg.text_enterEmail}"/>
                <h:inputText id="email" value="#{registration.email}"
                             size="20" required="true" label="Email Address">
                    <f:validator validatorId="e-mail validator" />
                </h:inputText>

                <p:message id="emailError" for="email" style="color:red" showSummary="true" showDetail="false" />


            </h:panelGrid>
            <!--<h:commandButton value="#{msg.text_sendCode}" action="#{registration.sendCode}" onclick="checkPass(this.form)"/>-->
            <h:commandButton value="#{msg.text_sendCode}" action="#{registration.sendCode}" update="growl"/>
            <br/>
            <h:commandLink value="#{msg.page_authorization}" action="/login/authorization" immediate="true"/>

            <h:panelGrid rendered="#{registration.codeSent}">
                <h:outputLabel value="#{msg.text_enterCode} : " />
                <h:inputText  label="Неверный проверочный код"
                              id="code" value="#{registration.checkCode}"
                              validator="#{registration.verificationСode}" />
                <p:message for="code"/>

                <h:commandButton value="#{msg.page_reg}" action="#{registration.addUser}" />
            </h:panelGrid>
        </h:form>


    </div>


</h:body>
</html>

